
import Encrypt from 'encryptlong';

var kk ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXd97DxhHKGPJwq1pT16aFsUzSEYfnVVfMhrvyXKRMb8ZMseQIa1X7MGeEP6q9SuO3nZ7YvoJp7LIVKaN7TaYtuaskdUKJlpK8oTX4ZSR/lksaHKSFHEAfBckL+bYZNHPu6Ck6pwNTOgoTxxbBEI17rrdhLBAvVCLlGP3R10NRCQIDAQAB"


//加密 返回Data
export const encryptData = function(word, keyStr, ivStr) {
	let jse = new Encrypt();
	jse.setPublicKey(kk)
	let result = jse.encryptLong(encodeURIComponent(word))
	return {
		"Body": result
	};
}

//加密 返回加密串
export const encrypt = function(word, keyStr, ivStr) {
	let jse = new Encrypt();
	jse.setPublicKey(kk)
	let result = jse.encryptLong(encodeURIComponent(word))

	return result
}


//解密
export const decrypt = function(word, keyStr, ivStr) {
	let jse = new Encrypt();
	jse.setPublicKey(kk)
	let result = jse.decryptLong(word)

	return decodeURIComponent(result)
}


export default {
	encrypt,
	decrypt,
	encryptData
}